//
// Created by sgyt on 2020/3/4.
// 型号屏蔽

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>

int main(int argc,char *argv[])
{
    sigset_t sigset,oldset;
    //初始化信号集
    sigemptyset(&sigset);
    sigemptyset(&oldset);

    //阻塞信号集中加入SIGINT
    sigaddset(&sigset,SIGINT);
    sigprocmask(SIG_BLOCK,&sigset,NULL);

    //查看是否有这些信号
    if(sigprocmask(0,NULL,&oldset)<0)
    {
        perror("sigprocmask is error\n");
    }else{
        if(sigismember(&oldset,SIGINT))
        {
            printf("SIGINT IS BLOCK\n");
        }

        if(sigismember(&oldset,SIGQUIT))
        {
            printf("SIGQUIT IS BLOCK\n");
        }
    }

    return 0;
}